#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  chdir("/home/zhangsan");
  FILE *fp = fopen("log.txt","w");
  if(fp == NULL)
  {
    perror("fopen");
  }
  fclose(fp);

  while(1)
  {
    printf("I am a process,pid:%d\n",getpid());
    sleep(1);
  }

  return 0;
}
